package sctu.edu.java.year2016.team07.nieying.day20160607.chapter12_2;

import sctu.edu.java.year2016.team06.chenqiang.day20160606.chapter12_2.Encryption;

/**
 * Created by Administrator on 2016/6/20 0020.
 */
public class Encryt {
    public static String EAndU(String value,char secret){
        byte[] bt=value.getBytes();
        for(int i=0;i<bt.length;i++){
         bt[i]=(byte)(bt[i]^(int)secret);

        }
        return  new String(bt,0,bt.length);


    }
    public static void main(String[] args){
        String value="I am nieying";
        char secret='家';
        System.out.println(""+value);
        String encrypt= Encryt.EAndU(value,secret);
        System.out.println(""+encrypt);
        String uncrypt=Encryt.EAndU(encrypt,secret);
        System.out.println(""+uncrypt);

    }
}
